﻿@using FineAdmin.Model;
@{
    ViewBag.Title = "欢迎来到diyuzz的小站";
    var BlogPostsCategorieList = ViewBag.BlogPostsCategorieList as List<BlogPostsCategorieModel>;
    BlogPostsCategorieList = BlogPostsCategorieList.Where(m => m.PId == ViewBag.PId).ToList();

    var BlogPostsList = ViewBag.BlogPostsList as List<BlogPostsModel>;


}
@section styles{
    <style>
        .banner {
            position: relative;
        }
        #bannerHide {
            position: absolute;
            bottom: 0px;
            right: 0px;
            color: gray;
            border: dotted;
            border-color: aliceblue;
        }
    </style>
}
<div class="banner">
    <div class="cont w1000">
        <div class="title">
            <h3>DIY~<br />UZZ</h3>
            <h4>What's up?  Back up .</h4>
        </div>
        @*<div class="amount">
            <p><span class="text">访问量</span><span class="access">1000</span></p>
            <p><span class="text">日志</span><span class="daily-record">1000</span></p>
        </div>*@
        
    </div>
    @*<div id="bannerHide">
        本次隐藏
    </div>*@
</div>

<div class="content" id="content">
    <div class="cont w1000">
        <div class="title">
            <span class="layui-breadcrumb" lay-separator="|">
                @*<a href="javascript:;" class="active">设计文章</a>
                    <a href="javascript:;">前端文章</a>
                    <a href="javascript:;">旅游杂记</a>*@
                <a href="/main?PId=@(ViewBag.PId)#content" @(ViewBag.CId == null ? "class=active" : "")>全部</a>
                @foreach (var item in BlogPostsCategorieList)
                {
                    <a href="/main?PId=@(item.PId)&CId=@(item.Id)#content" @(ViewBag.CId == item.Id ? "class=active" : "")>@item.Name</a>
                }
            </span>
        </div>
        <div class="list-item">
            @foreach (var item in BlogPostsList)
            {
                <div class="item">
                    <div class="layui-fluid">
                        <div class="layui-row">
                            @*<div class="layui-col-xs12 layui-col-sm4 layui-col-md5">
                                    <div class="img"><img src="../BlogStatic/img/sy_img1.jpg" alt=""></div>
                                </div>*@
                            <div class="layui-col-xs12 layui-col-sm12 layui-col-md12">
                                <a href="/Blog/BlogDetail?Id=@item.Id">
                                    <div class="item-cont">
                                        <h3>
                                            @item.Title
                                            @if (item.CreateTime.AddDays(7) >= DateTime.Now)
                                            {
                                                <button class="layui-btn layui-btn-danger new-icon">new</button>
                                            }
                                        </h3>
                                        <h5>@item.CName</h5>
                                        @if (!string.IsNullOrWhiteSpace(item.Excerpt))
                                        {
                                            <p>@item.Excerpt</p>
                                        }
                                        else
                                        {
                                            <p>@item.BlogContent</p>
                                        }
                                        @*<a href="#" class="go-icon"></a>*@
                                        <hr>
                                    </div>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            }
            @*<div class="item">
                    <div class="layui-fluid">
                        <div class="layui-row">
                            <div class="layui-col-xs12 layui-col-sm4 layui-col-md5">
                                <div class="img"><img src="../BlogStatic/img/sy_img2.jpg" alt=""></div>
                            </div>
                            <div class="layui-col-xs12 layui-col-sm8 layui-col-md7">
                                <div class="item-cont">
                                    <h3>空间立体效果图，完美呈现最终效果<button class="layui-btn layui-btn-danger new-icon">new</button></h3>
                                    <h5>设计文章</h5>
                                    <p>室内设计作为一门新兴的学科，尽管还只是近数十年的事，但是人们有意识地对自己生活、生产活动的室内进行安排布置，甚至美化装饰，赋予室内环境以所祈使的气氛，却早巳从人类文明伊始的时期就已存在</p>
                                    <a href="details.html" class="go-icon"></a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="item">
                    <div class="layui-fluid">
                        <div class="layui-row">
                            <div class="layui-col-xs12 layui-col-sm4 layui-col-md5">
                                <div class="img"><img src="../BlogStatic/img/sy_img3.jpg" alt=""></div>
                            </div>
                            <div class="layui-col-xs12 layui-col-sm8 layui-col-md7">
                                <div class="item-cont">
                                    <h3>空间立体效果图，完美呈现最终效果<button class="layui-btn layui-btn-danger new-icon">new</button></h3>
                                    <h5>设计文章</h5>
                                    <p>室内设计作为一门新兴的学科，尽管还只是近数十年的事，但是人们有意识地对自己生活、生产活动的室内进行安排布置，甚至美化装饰，赋予室内环境以所祈使的气氛，却早巳从人类文明伊始的时期就已存在</p>
                                    <a href="details.html" class="go-icon"></a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="item">
                    <div class="layui-fluid">
                        <div class="layui-row">
                            <div class="layui-col-xs12 layui-col-sm4 layui-col-md5">
                                <div class="img"><img src="../BlogStatic/img/sy_img4.jpg" alt=""></div>
                            </div>
                            <div class="layui-col-xs12 layui-col-sm8 layui-col-md7">
                                <div class="item-cont">
                                    <h3>空间立体效果图，完美呈现最终效果<button class="layui-btn layui-btn-danger new-icon">new</button></h3>
                                    <h5>设计文章</h5>
                                    <p>室内设计作为一门新兴的学科，尽管还只是近数十年的事，但是人们有意识地对自己生活、生产活动的室内进行安排布置，甚至美化装饰，赋予室内环境以所祈使的气氛，却早巳从人类文明伊始的时期就已存在</p>
                                    <a href="details.html" class="go-icon"></a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="item">
                    <div class="layui-fluid">
                        <div class="layui-row">
                            <div class="layui-col-xs12 layui-col-sm4 layui-col-md5">
                                <div class="img"><img src="../BlogStatic/img/sy_img5.jpg" alt=""></div>
                            </div>
                            <div class="layui-col-xs12 layui-col-sm8 layui-col-md7">
                                <div class="item-cont">
                                    <h3>空间立体效果图，完美呈现最终效果<button class="layui-btn layui-btn-danger new-icon">new</button></h3>
                                    <h5>设计文章</h5>
                                    <p>室内设计作为一门新兴的学科，尽管还只是近数十年的事，但是人们有意识地对自己生活、生产活动的室内进行安排布置，甚至美化装饰，赋予室内环境以所祈使的气氛，却早巳从人类文明伊始的时期就已存在</p>
                                    <a href="details.html" class="go-icon"></a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>*@
        </div>
        <div id="demo" style="text-align: center;"></div>
    </div>
</div>
@section scripts{
    <script>
        var count = @ViewBag.Total;
        var page=@ViewBag.Page;
    </script>
    <script type="text/javascript">
        layui.config({
            base: '../BlogStatic/js/util/'
        }).use(['element', 'laypage', 'jquery', 'menu'], function () {
            element = layui.element, laypage = layui.laypage, $ = layui.$, menu = layui.menu;
            laypage.render({
                elem: 'demo'
                , limit: 10
                , curr: page
                , count: count //数据总数，从服务端得到
                , jump: function (obj, first) {
                    //obj包含了当前分页的所有参数，比如：
                    console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                    console.log(obj.limit); //得到每页显示的条数

                    //首次不执行
                    if (!first) {
                        //do something
                        window.location.href = "/Main/Index?PId=@(ViewBag.PId)&CId=@(ViewBag.CId)&p=@ViewBag.Page";
                    }
                }
            });

            menu.init();
        })
    </script>
}


